package com.atguigu.realtime.function;

import com.atguigu.realtime.util.IKUtil;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

import java.util.Collection;


/**
 * Created by GodRUI on 2021/7/5 17:49
 */
@FunctionHint(output = @DataTypeHint("row<word string>"))
public class KeyWordUdtf extends TableFunction<Row> {

    public void eval(String word){

        Collection<String> words = IKUtil.analyzer(word);

        for (String s : words) {
            collect(Row.of(s));
        }

    }

}
